﻿<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:controls="clr-namespace:Corina.Controls.Win;assembly=Corina.Controls.Win"
      xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
      xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
      xmlns:localViewmodel="clr-namespace:Corina.Win.ServerHub.Viewmodels"
      FontSize="14">
    <Page.DataContext>
        <localViewmodel:LoginViewmodel />
    </Page.DataContext>
    <Grid>
        <Grid Margin="0,50,0,0"
              HorizontalAlignment="Center"
              VerticalAlignment="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Border Grid.ColumnSpan="2"
                    Background="{DynamicResource COLOR_LIGHTGRAY}"
                    CornerRadius="3">
                <Border.Effect>
                    <DropShadowEffect BlurRadius="10"
                                      Opacity=".8"
                                      ShadowDepth="0" />
                </Border.Effect>
            </Border>

            <Path Width="100"
                  Height="100"
                  Margin="12,24"
                  HorizontalAlignment="Left"
                  VerticalAlignment="Top"
                  Data="{Binding Converter={StaticResource StringToPathGeometryConverter},
                                 Mode=OneWay,
                                 Source={StaticResource ICON_SERVER}}"
                  RenderTransformOrigin="0.5,0.5"
                  Stretch="Uniform">
                <Path.Fill>
                    <RadialGradientBrush GradientOrigin="0.439,-0.062" RadiusX="0.519" RadiusY="0.519">
                        <RadialGradientBrush.RelativeTransform>
                            <TransformGroup>
                                <ScaleTransform CenterX="0.5"
                                                CenterY="0.5"
                                                ScaleX="1"
                                                ScaleY="1" />
                                <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5" />
                                <RotateTransform Angle="-3.44" CenterX="0.5" CenterY="0.5" />
                                <TranslateTransform />
                            </TransformGroup>
                        </RadialGradientBrush.RelativeTransform>
                        <GradientStop Offset="0.999" Color="#FF3399FF" />
                        <GradientStop Color="#FF002A55" />
                    </RadialGradientBrush>
                </Path.Fill>
                <Path.RenderTransform>
                    <TransformGroup>
                        <RotateTransform Angle="0" />
                        <ScaleTransform ScaleX="1" ScaleY="1" />
                    </TransformGroup>
                </Path.RenderTransform>
            </Path>

            <StackPanel Grid.Column="1"
                        Width="250"
                        Margin="12">
                <Label Content="帐号" />
                <TextBox Text="{Binding LoginAccount, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                <Label Content="密码" />
                <PasswordBox>
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="PasswordChanged">
                            <ei:CallMethodAction MethodName="OnPasswordChanged" TargetObject="{Binding}" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </PasswordBox>
                <Button Margin="0,12"
                        HorizontalAlignment="Right"
                        Command="{Binding LoginCommand,
                                          Mode=OneWay}"
                        Content="登录"
                        IsDefault="True" />
                <!--  <PasswordBox Helper:PasswordBoxHelper.Attach="True" Helper:PasswordBoxHelper.Password="{Binding Path=Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />  -->
            </StackPanel>
        </Grid>
        <controls:BusyIndicator BusyContent="正在登录，请稍后……" IsBusy="{Binding IsBusy}" />
    </Grid>
</Page>